import axios from 'axios';
//创建实例
const instance = axios.create();
// 添加一个请求拦截器
instance.defaults.baseURL='http://mobile.bwstudent.com/';
instance.interceptors.request.use(
  config => {
    if (localStorage.getItem('user_info')) {
      const user = JSON.parse(localStorage.getItem('user_info'));
      config.headers.userId = user.userId;
      config.headers.sessionId = user.sessionId;
    }
    return config;
  },
  error => {
    return Promise.reject(error);
  });
export default instance;